package com.myzhouye.business.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.myzhouye.business.entity.TaskInfo;
import com.myzhouye.business.entity.TaskNodeConfig;
import com.myzhouye.business.mapper.TaskInfoMapper;
import com.myzhouye.business.mapper.TaskNodeConfigMapper;
import com.myzhouye.business.service.ITaskInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.List;

/**
 * <p>
 * 任务信息 服务实现类
 * </p>
 *
 * @author maple
 * @since 2024-01-04
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class TaskInfoServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo> implements ITaskInfoService {
    private final TaskNodeConfigMapper taskNodeConfigMapper;

    @Override
    public List<TaskNodeConfig> getNodeConfig(String id) {
        List<TaskNodeConfig> taskNodeList = taskNodeConfigMapper.selectList(Wrappers.<TaskNodeConfig>lambdaQuery().
                eq(TaskNodeConfig::getTaskId, id).
                orderByAsc(TaskNodeConfig::getSort));
        return taskNodeList;
    }

    @Override
    public void pushStatus(SseEmitter connect, String groupId) {

    }
}
